import java.util.Random;

class Hero {
    private int hp = 500;
    private final Random random = new Random();

    public int attack() {
        int baseDamage = random.nextInt(102);
        if (random.nextInt(100) < 10) {
            System.out.println("英雄触发暴击！");
            baseDamage *= 2;
        }
        if (random.nextInt(100) < 5) {
            int heal = random.nextInt(20) + 10;
            hp += heal;
            System.out.println("英雄触发回血，回复了 " + heal + " 点血量");
        }
        return baseDamage;
    }

    public void takeDamage(int damage) {
        hp = Math.max(0, hp - damage);
    }

    public boolean isAlive() {
        return hp > 0;
    }

    public int getHp() {
        return hp;
    }
}

class Monster {
    private int hp = 500;
    private final Random random = new Random();

    public int attack() {
        int baseDamage = random.nextInt(151);
        if (random.nextInt(100) < 5) {
            System.out.println("怪兽触发暴击！");
            baseDamage *= 2;
        }
        if (random.nextInt(100) < 3) {
            int heal = random.nextInt(30) + 15;
            hp += heal;
            System.out.println("怪兽触发回血，回复了 " + heal + " 点血量");
        }
        return baseDamage;
    }

    public void takeDamage(int damage) {
        hp = Math.max(0, hp - damage);
    }

    public boolean isAlive() {
        return hp > 0;
    }

    public int getHp() {
        return hp;
    }
}

public class HeroMonsterBattle {
    public static void main(String[] args) {
        Hero hero = new Hero();
        Monster monster = new Monster();
        boolean isMonsterTurn = true;

        while (hero.isAlive() && monster.isAlive()) {
            if (isMonsterTurn) {
                int damage = monster.attack();
                hero.takeDamage(damage);
                System.out.println("怪兽攻击英雄，英雄掉血 " + damage + "，英雄剩余血量 " + hero.getHp());
            } else {
                int damage = hero.attack();
                monster.takeDamage(damage);
                System.out.println("英雄攻击怪兽，怪兽掉血 " + damage + "，怪兽剩余血量 " + monster.getHp());
            }
            isMonsterTurn = !isMonsterTurn;
        }

        if (hero.isAlive()) {
            System.out.println("怪兽被消灭，英雄获胜");
        } else {
            System.out.println("英雄阵亡，怪兽获胜");
        }
    }
}